# coding: utf-8


def reverse_string(input):
    if len(input) <= 1:
        return input
    else:
        return input[-1] + reverse_string(input[0:-1])


print(reverse_string('abcdefg'))
print(reverse_string('123456789'))
